<template>
    <div>
        <!-- 添加岗位 -->
        <el-form :model="formDate" ref="form" label-width="80px" :inline="false">
            <el-row>
                <el-col :span="24">
                    <el-form-item label="岗位编码">
                        <el-input v-model="formDate.postCode"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="24">
                    <el-form-item label="岗位名称">
                        <el-input v-model="formDate.postName"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="24">
                    <el-form-item label="岗位排序">
                        <el-input-number v-model="num" :min="0" :max="1000" controls-position="right" size="large"
                            @change="handleChange" />
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="24">
                    <el-form-item label="岗位状态">
                        <el-radio-group v-model="radio">
                            <el-radio value="0">正常</el-radio>
                            <el-radio value="1">停用</el-radio>
                        </el-radio-group>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="24">
                    <el-form-item label="备注">
                        <el-input v-model="formDate.remark"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="24">
                    <el-form-item>
                        <el-button type="primary" @click="onSubmit">确定</el-button>
                        <el-button>取消</el-button>
                    </el-form-item>
                </el-col>
            </el-row>

        </el-form>
    </div>
</template>

<script setup>
import { ref, defineEmits } from 'vue'
import request from '@/api/request';
let emits = defineEmits(['close'])

let formDate = ref({})
//排序框
const num = ref('')
const handleChange = (value) => {
    console.log(value)
}

//单选框
let radio = ref('0')

let onSubmit = () => {
    console.log(radio.value)
    console.log(formDate.value)
    console.log(num.value)
    request({
        url: '/slm/posts/insert',
        method: 'post',
        data: {
            postCode: formDate.value.postCode,
            postName: formDate.value.postName,
            postSort: num.value,
            status: radio.value,
            remark: formDate.value.remark
        }
        , headers: { "Content-Type": "application/json" }
    }).then(resp => {
        emits('close')
    })
}
</script>

<style lang='scss' scoped></style>
